<template>
  <div class="student-management">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>学员管理</span>
          <el-button type="primary">新增学员</el-button>
        </div>
      </template>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="id" label="学号" width="120" />
        <el-table-column prop="name" label="姓名" width="120" />
        <el-table-column prop="gender" label="性别" width="80" />
        <el-table-column prop="age" label="年龄" width="80" />
        <el-table-column prop="phone" label="联系电话" width="150" />
        <el-table-column prop="className" label="所属班级" width="150" />
        <el-table-column prop="joinTime" label="入学时间" width="150" />
        <el-table-column label="操作" width="200">
          <template #default="scope">
            <el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
            <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const tableData = ref([
  {
    id: 'XS001',
    name: '张小明',
    gender: '男',
    age: 20,
    phone: '13800138000',
    className: 'Web全栈开发班',
    joinTime: '2024-01-15'
  },
  {
    id: 'XS002',
    name: '李小红',
    gender: '女',
    age: 19,
    phone: '13800138001',
    className: 'Java企业开发班',
    joinTime: '2024-01-16'
  }
])

const handleEdit = (row) => {
  console.log('编辑', row)
}

const handleDelete = (row) => {
  console.log('删除', row)
}
</script>

<style scoped>
.student-management {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style> 